﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace poco
{
    public class PluralFields<T> : List<T> where T : PluralField
    {
        public PluralFields()
        {
        }

        public PluralFields(T[] items)
            : base(items)
        {
        }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            if (obj.GetType() != this.GetType()) return false;

            PluralFields<T> other = (PluralFields<T>)obj;

            if (this.Count != other.Count) return false;

            foreach (T item in this)
            {
                if (!other.Contains(item)) return false;
            }

            return true;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
